var Active = require('../../models/active/active')

module.exports = {

  getActiveList: function(req, res) {

    var skip = + req.params.skip
    var limit = + req.params.limit

    Active.find({}).sort({createdAt: -1}).skip(skip).limit(limit).exec(function (err, actives) {
        if (err) {
            console.log('activeController getActiveList fail. err = ' + err)
            return res.json({code: 177, msg: '获取失败'})
        }
        if (!actives.length) {
            return res.json({code: 112, msg: '没有数据'})
        }
        return res.json({code: 100, data: {list: actives}})
    })
  }
}